import java.util.Arrays;

/**
 * @ClassName LC283
 * @Author ykx
 * @Date 2024/6/29 17:30
 * @Version 1.0
 */
public class LC283 {
    public static void main(String[] args) {
        LC283 lc283 = new LC283();
        int[] nums = {0, 1, 0, 3, 12};
        lc283.moveZeroes(nums);
        System.out.println(Arrays.toString(nums));
    }

    public void moveZeroes(int[] nums) {
        int i = 0;
        for (int j = 0; j < nums.length; j++) {
            if (nums[j] != 0) {
                int temp = nums[j];
                nums[j] = nums[i];
                nums[i] = temp;
                i++;
            }
        }
    }
}
